﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Fluent="clr-namespace:Fluent" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
  <Style TargetType="Separator" x:Key="GroupBoxSeparator">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="Separator">
        	<Border Width="3" Height="55" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2,5,2,10" BorderThickness="1,0" BorderBrush="{DynamicResource GroupBoxSeparatorBorderBrush}" Background="{DynamicResource GroupBoxSeparatorBackgroundBrush}"/>
          
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
	<Style x:Key="RibbonGroupBoxStyle" TargetType="{x:Type Fluent:RibbonGroupBox}">
		<Setter Property="Template" Value="{DynamicResource RibbonGroupBoxControlTemplate}"/>
		<Setter Property="Width" Value="Auto"/>
		<Setter Property="Height" Value="85"/>
		<Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}"/>
		<Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}"/>
		<Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
		<Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
		<Setter Property="FocusManager.IsFocusScope" Value="False"/>
		<Setter Property="Focusable" Value="False"/>
	</Style>
	<ControlTemplate x:Key="RibbonGroupBoxControlTemplate" TargetType="{x:Type Fluent:RibbonGroupBox}">
		<ControlTemplate.Resources>
			<Storyboard x:Key="OnMouseEnter1">
				<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="hoverGrid" Storyboard.TargetProperty="(UIElement.Opacity)">
					<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
				</DoubleAnimationUsingKeyFrames>
			</Storyboard>
			<Storyboard x:Key="OnMouseLeave1">
				<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="hoverGrid" Storyboard.TargetProperty="(UIElement.Opacity)">
					<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
				</DoubleAnimationUsingKeyFrames>
			</Storyboard>
      <Style TargetType="Separator" BasedOn="{StaticResource GroupBoxSeparator}"/>
		</ControlTemplate.Resources>
		<Grid x:Name="grid2" HorizontalAlignment="Stretch">
		
				<Grid Background="#00000000">

			<Grid x:Name="hoverGrid" Background="{DynamicResource GroupHoverBrush}" HorizontalAlignment="Stretch" Margin="0,0,1,1" VerticalAlignment="Stretch" Width="Auto" Height="Auto" ClipToBounds="True" Opacity="0" Grid.RowSpan="2">
				<Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Fill="{DynamicResource GroupHighlightBrush}"/>
			</Grid>
			<ContentControl x:Name="border1">
			<Grid x:Name="PART_ParentPanel" Margin="0,1,0,2" Grid.RowSpan="2" Height="85">
						<Grid.RowDefinitions>
				<RowDefinition Height="*"/>
				<RowDefinition Height="17"/>
			</Grid.RowDefinitions>
				<Grid x:Name="PART_DownGrid" Margin="0,-2,2,2" Grid.Row="1" VerticalAlignment="Bottom" Height="17">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="Auto"/>
					</Grid.ColumnDefinitions>
					<TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="{TemplateBinding Header}" TextWrapping="NoWrap" Grid.Row="1" Foreground="{DynamicResource GroupBoxFontBrush}" Margin="2,0" TextTrimming="CharacterEllipsis" TextAlignment="Center"/>
					<Fluent:Button Margin="0,0,1,1" x:Name="PART_DialogLauncherButton" HorizontalAlignment="Stretch" Width="15" Height="14" Grid.Column="1" Focusable="False" IsTabStop="False" Template="{DynamicResource DialogLauncherButtonControlTemplate}" VerticalAlignment="Bottom" Icon="{TemplateBinding LauncherIcon}" Text="{TemplateBinding LauncherText}" Command="{Binding LauncherCommand, RelativeSource={RelativeSource TemplatedParent}}" CommandTarget="{Binding LauncherCommandTarget, RelativeSource={RelativeSource TemplatedParent}}" CommandParameter="{Binding LauncherCommandParameter, RelativeSource={RelativeSource TemplatedParent}}" ToolTip="{Binding LauncherToolTip, RelativeSource={RelativeSource TemplatedParent}}"  IsEnabled="{Binding IsLauncherEnabled, RelativeSource={RelativeSource TemplatedParent}}"/>
				</Grid>
				<WrapPanel x:Name="PART_UpPanel" VerticalAlignment="Stretch" Width="Auto" Height="Auto" IsItemsHost="True" Margin="2,0,4,0" Orientation="Vertical" FocusManager.IsFocusScope="False"/>
			</Grid>
			</ContentControl>
			<Grid x:Name="grid1" Margin="0" Width="Auto" Height="Auto" Background="#00000000" Visibility="Collapsed" Grid.RowSpan="2">			
				<Fluent:TwoLineLabel HorizontalAlignment="Center" VerticalAlignment="Top" Text="{TemplateBinding Header}" Margin="5,38,5,0" HasGlyph="True" HasTwoLines="True" Style="{DynamicResource TwoLineLabelStyle}"/>
				<Border HorizontalAlignment="Center" VerticalAlignment="Top" Width="31" Height="31" BorderBrush="#FFD0D4D9" BorderThickness="1" Margin="5,3,8,0" CornerRadius="3">
					<Image Source="{TemplateBinding Icon}" Stretch="None"/>
				</Border>
				<Fluent:RibbonPopup x:Name="PART_Popup" Width="Auto" Height="Auto" AllowsTransparency="True" PlacementTarget="{Binding ElementName=grid1, Mode=OneWay}" StaysOpen="True">
					<Grid Width="Auto" Height="Auto" Margin="0,20">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*"/>
							<ColumnDefinition Width="5"/>
						</Grid.ColumnDefinitions>
						<Grid.RowDefinitions>
							<RowDefinition Height="*"/>
							<RowDefinition Height="5"/>
						</Grid.RowDefinitions>
						<Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="11,-1,1,0" VerticalAlignment="Stretch" Height="Auto" Grid.Column="0" Grid.Row="1" Grid.RowSpan="1">
							<Rectangle.Fill>
								<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
									<GradientStop Color="#7F000000" Offset="0"/>
									<GradientStop Offset="1"/>
								</LinearGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
						<Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="-1,11,0,1" VerticalAlignment="Stretch" Height="Auto" Grid.Column="1" Grid.Row="0" Grid.RowSpan="1">
							<Rectangle.Fill>
								<LinearGradientBrush EndPoint="1.002,0" MappingMode="RelativeToBoundingBox">
									<GradientStop Color="#7F000000" Offset="0"/>
									<GradientStop Offset="1"/>
								</LinearGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
						<Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="-1,-1,0,0" VerticalAlignment="Stretch" Height="Auto" Grid.Column="1" Grid.Row="1" Grid.RowSpan="1">
							<Rectangle.Fill>
								<RadialGradientBrush Center="-0.003,0.011" GradientOrigin="-0.003,0.011" RadiusX="1.006" RadiusY="1">
									<GradientStop Color="#7F000000" Offset="0.002"/>
									<GradientStop Offset="1"/>
								</RadialGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
						<Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Stretch" Margin="-1,5,0,0" VerticalAlignment="Top" Height="6" Grid.Column="1" Grid.Row="0" Grid.RowSpan="1">
							<Rectangle.Fill>
								<RadialGradientBrush Center="-0.01,1.004" GradientOrigin="-0.01,1.004" RadiusX="1.006" RadiusY="1">
									<GradientStop Color="#7F000000" Offset="0.002"/>
									<GradientStop Offset="1"/>
								</RadialGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
						<Rectangle Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Left" Margin="5,-1,0,0" VerticalAlignment="Stretch" Height="Auto" Grid.Column="0" Grid.Row="1" Grid.RowSpan="1" Width="6">
							<Rectangle.Fill>
								<RadialGradientBrush Center="1.003,-0.006" GradientOrigin="1.003,-0.006" RadiusX="1.006" RadiusY="1">
									<GradientStop Color="#7F000000" Offset="0.002"/>
									<GradientStop Offset="1"/>
								</RadialGradientBrush>
							</Rectangle.Fill>
						</Rectangle>
						<Border x:Name="border" Height="Auto" Grid.RowSpan="1" Background="{DynamicResource RibbonBackgoundBrush}" BorderBrush="{DynamicResource RibbonTopBorderBrush}" BorderThickness="1" CornerRadius="1" d:LayoutOverrides="Width">
							<ContentControl x:Name="popupContent"/>
						</Border>

					</Grid>
				</Fluent:RibbonPopup>
			</Grid>
			<Border x:Name="separator" BorderBrush="{DynamicResource GroupSeparatorBorderBrush}" Background="{DynamicResource GroupSeparatorBackgroundBrush}" HorizontalAlignment="Right" VerticalAlignment="Stretch" Width="3" Height="Auto" Grid.RowSpan="2" BorderThickness="1,0"/>
		</Grid>
			
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="State" Value="Collapsed">
				<Setter Property="Visibility" TargetName="grid1" Value="Visible"/>
				<Setter Property="UIElement.Visibility" TargetName="border1" Value="Collapsed"/>
				<Setter Property="HorizontalAlignment" TargetName="grid2" Value="Left"/>							
				<Setter Property="Content" TargetName="border1" Value="{x:Null}"/>							
				<Setter Property="Content" TargetName="popupContent" Value="{Binding ElementName=PART_ParentPanel}"/>
			</Trigger>
			<EventTrigger RoutedEvent="Mouse.MouseLeave">
				<BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
			</EventTrigger>
			<EventTrigger RoutedEvent="Mouse.MouseEnter">
				<BeginStoryboard Storyboard="{StaticResource OnMouseEnter1}"/>
			</EventTrigger>
			<Trigger Property="IsFocused" Value="True">
				<Setter Property="Opacity" TargetName="hoverGrid" Value="1"/>
			</Trigger>
			<Trigger Property="IsMouseOver" Value="True">
				<Setter Property="Opacity" TargetName="hoverGrid" Value="1"/>
			</Trigger>
			<Trigger Property="IsOpen" Value="True">
				<Setter Property="Opacity" TargetName="hoverGrid" Value="1"/>
			</Trigger>
			<Trigger Property="IsLauncherVisible" Value="False">
				<Setter Property="Visibility" TargetName="PART_DialogLauncherButton" Value="Collapsed"/>
			</Trigger>
			<Trigger Property="IsOpen" Value="True">
				<Setter Property="Opacity" TargetName="hoverGrid" Value="1"/>
				<!--<Setter Property="Visibility" TargetName="rectangle" Value="Collapsed"/>-->
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>
	<ControlTemplate x:Key="DialogLauncherButtonControlTemplate" TargetType="{x:Type Fluent:Button}">
		<Border x:Name="border" BorderThickness="1" CornerRadius="1,0,0,0" Background="{DynamicResource TransparentBrush}" BorderBrush="{DynamicResource TransparentBrush}">
			<Border x:Name="border1" Width="Auto" Height="Auto" BorderThickness="1" CornerRadius="1,0,0,0" Background="{DynamicResource TransparentBrush}" BorderBrush="{DynamicResource TransparentBrush}">
				<Image x:Name="image" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Source="pack://application:,,,/Fluent;Component\Themes\Office2010\Images\DialogLauncher.png" SnapsToDevicePixels="True" Stretch="None" RenderOptions.BitmapScalingMode="NearestNeighbor" RenderTransformOrigin="0.5,0.5">
					<Image.RenderTransform>
						<TransformGroup>
							<ScaleTransform/>
							<SkewTransform/>
							<RotateTransform/>
							<TranslateTransform/>
						</TransformGroup>
					</Image.RenderTransform>
				</Image>
			</Border>
		</Border>
		<ControlTemplate.Triggers>
			<Trigger Property="FlowDirection" Value="RightToLeft">
				<Setter Property="RenderTransform" TargetName="image">
					<Setter.Value>
						<TransformGroup>
							<ScaleTransform ScaleX="-1"/>
							<SkewTransform/>
							<RotateTransform/>
							<TranslateTransform/>
						</TransformGroup>
					</Setter.Value>
				</Setter>
			</Trigger>
			<Trigger Property="IsPressed" Value="True">
				<Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonPressedOuterBackgroundBrush}"/>
				<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonPressedOuterBorderBrush}"/>
				<Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBorderBrush}"/>
				<Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBackgroundBrush}"/>
			</Trigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsMouseOver" Value="True"/>
					<Condition Property="IsPressed" Value="False"/>
				</MultiTrigger.Conditions>
				<Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
				<Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
				<Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
				<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
			</MultiTrigger>			
		</ControlTemplate.Triggers>
	</ControlTemplate>
</ResourceDictionary>